home *** CD-ROM | disk | FTP | other *** search
/ SGI MIPSpro C Compiler 7.2 / SGI MIPSpro C Compiler 7.2.iso / relnotes / c_fe / ch4.z / ch4
Text File  |  1997-09-05  |  15KB  |  528 lines

  1.  
  2.  
  3.  
  4.                                                - 1 -
  5.  
  6.  
  7.  
  8.                     7.2 ANSI C Front-End Release Notes
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.                                                - 2 -
  69.  
  70.  
  71.  
  72.                     DDDDooooccccuuuummmmeeeennnntttt NNNNuuuummmmbbbbeeeerrrr 000000007777----1111666655559999----000011110000
  73.  
  74.  
  75.                     4.  _N_e_w__F_e_a_t_u_r_e_s__o_f__T_h_i_s__R_e_l_e_a_s_e
  76.  
  77.                     This chapter contains the differences between
  78.                     this release and the 7.1 release of MIPSpro C
  79.                     compiler.
  80.  
  81.  
  82.                     4.1  _R_e_p_a_c_k_a_g_i_n_g__o_f__F_r_o_n_t_-_E_n_d__S_u_b_s_y_s_t_e_m_s
  83.  
  84.  
  85.                     Under the 7.2 release, the C compiler front-end
  86.                     is packaged in its own subsystem on a separate
  87.                     CD. For proper installation, you must install
  88.                     _c_o_m_p_i_l_e_r__d_e_v, _c_o_m_p_i_l_e_r__e_o_e and _c__d_e_v from the
  89.                     IRIX Development Foundation CD as well as _c__f_e
  90.                     from the MIPSpro C Compiler CD.
  91.  
  92.  
  93.  
  94.                     4.2  _N_e_w__O_p_t_i_o_n_s__a_n_d__D_e_f_a_u_l_t_s
  95.  
  96.  
  97.                     A new -_D_E_B_U_G:_o_p_t_i_o_n control group has been
  98.                     created to allow insertion of code to assist in
  99.                     the debugging of programs.  For example,
  100.                     -_D_E_B_U_G:_d_i_v__c_h_e_c_k=_N replaces -_T_E_N_V:_c_h_e_c_k__d_i_v=_N
  101.                     and the 7.2 compiler, by default, inserts code
  102.                     to check for divide by zero (N=1).
  103.  
  104.                     _N_O_T_E:  The default value for -_T_E_N_V:_c_h_e_c_k__d_i_v=_N
  105.                     under MIPSpro 7.1 was N=0 (no checks).
  106.  
  107.                     For more information, please refer to the _c_c(1)
  108.                     and _D_E_B_U_G__g_r_o_u_p(5) man pages.
  109.  
  110.                     The -_L_I_S_T: options control group has been
  111.                     enhanced to the create a listing file (.l) that
  112.                     contains the values of all flags  modified,
  113.                     directly in the command line, or indirectly as a
  114.                     side effect of other options. For example:
  115.  
  116.                     % cc -n32 -LIST:options=ON foo.c
  117.  
  118.                     will create foo.l which contains a listing that
  119.                     contains the default values of certain options
  120.                     from the -OPT, -LNO, -TARG and -TENV option
  121.                     control groups.
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                                                - 3 -
  135.  
  136.  
  137.  
  138.                     The following command:
  139.  
  140.                     % cc -n32 -LIST:all_options=ON foo.c
  141.  
  142.                     will create foo.l which contains a listing that
  143.                     contains the default values of all options from
  144.                     all of the option control groups.
  145.  
  146.                     For more information, please refer to the _c_c(1)
  147.                     man page.
  148.  
  149.  
  150.                     4.3  _O_b_s_o_l_e_t_e__O_p_t_i_o_n_s
  151.  
  152.  
  153.                     Several compile-time flags have been obsoleted.
  154.                     These include: -_T_E_N_V:_m_i_s_a_l_i_g_n_e_m_n_t=_N,
  155.                     -_T_E_N_V:_a_l_i_g_n__e_x_t_e_r_n=_N and -_T_E_N_V:_a_l_i_g_n_e_d=_T_R_U_E.
  156.                     Their use will generate a warning message in
  157.                     both the compiler front-end and backend. For
  158.                     example:
  159.  
  160.                     % cc -n32 -TENV:misalignment=3 reshape.c
  161.                     Warning: Obsolete option "-TENV:misalignment=3" -- ignored
  162.                     Warning: Obsolete option "-TENV:misalignment=3" -- ignored
  163.  
  164.                     The -_T_E_N_V:_v_a_r_a_r_g_s__p_r_o_t_o_t_y_p_e_s=_T_R_U_E flag has been
  165.                     replaced by -_D_E_B_U_G:_v_a_r_a_r_g_s__p_r_o_t_o_t_y_p_e_s=_T_R_U_E.
  166.  
  167.                     For more information, please refer to the _c_c(1)
  168.                     and _D_E_B_U_G__g_r_o_u_p(5) man pages.
  169.  
  170.  
  171.  
  172.                     4.4  _V_a_r_i_a_b_l_e__L_e_n_g_t_h__A_r_r_a_y_s
  173.  
  174.  
  175.                     MIPSpro 7.2 now supports variable length arrays.
  176.                     Array dummy arguments and local arrays can now
  177.                     be declared as variable length arrays rather
  178.                     than as pointers.  This allows the compiler to
  179.                     make assumptions about aliasing and can allow
  180.                     more optimizations to be applied to code
  181.                     containing references to the array.  This is
  182.                     particularly beneficial for parallelization.
  183.                     The syntax for variable length arrays is:
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.                                                - 4 -
  201.  
  202.  
  203.  
  204.                         int foo( int n, float a[n][n] ) {
  205.                            float b[n]
  206.                         }
  207.  
  208.  
  209.                     In the example above, dummy argument a and local
  210.                     variable b are both variable length arrays.
  211.  
  212.  
  213.                     4.5  _F_r_e_q_u_e_n_c_y__h_i_n_t__p_r_a_g_m_a_s
  214.  
  215.  
  216.                     MIPSpro 7.2 now supports a new pragma "#pragma
  217.                     mips_freqency_hint" that is used to tell the
  218.                     compiler that a branch or function is rarely or
  219.                     frequently executed.  The compiler uses this
  220.                     information to make better optimization
  221.                     decisions. A branch can be marked as infreqently
  222.                     taken in this fashion:
  223.  
  224.  
  225.                         if ( a < b ) {
  226.                         #pragma mips_frequency_hint NEVER
  227.                            printf("error condition0);
  228.                         }
  229.  
  230.  
  231.                     While a function can be so marked this way:
  232.  
  233.  
  234.                         void handle_error( int i );
  235.                         #pragma mips_frequency_hint NEVER handle_error
  236.  
  237.  
  238.                     To specify that a block of code gets frequently
  239.                     executed, you can use:
  240.  
  241.                     #pragma mips_frequency_hint FREQUENT
  242.  
  243.                     Frequency information about a function gets
  244.                     propogated to all instances where the function
  245.                     is used. So a branch that contains a call to an
  246.                     infrequent function is considered infrequently
  247.                     executed itself.
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.                                                - 5 -
  267.  
  268.  
  269.  
  270.                     4.6  _F_i_l_l__a_n_d__A_l_i_g_n__P_r_a_g_m_a__S_u_p_p_o_r_t
  271.  
  272.  
  273.                     MIPSpro 7.2 C supports new types of pragmas to
  274.                     facilitate padding and alignment of variables
  275.                     within cachelines and pages of memory. They are
  276.                     outlined below.
  277.  
  278.  
  279.                     #pragma fill_symbol (s, L1cacheline)
  280.                     #pragma fill_symbol (s, L2cacheline)
  281.                     #pragma fill_symbol (s, page)
  282.                     #pragma fill_symbol (s, <user-specified-power-of-two>)
  283.                     #pragma align_symbol (s, L1cacheline)
  284.                     #pragma align_symbol (s, L2cacheline)
  285.                     #pragma align_symbol (s, page)
  286.                     #pragma align_symbol (s, <user-specified-power-of-two>)
  287.  
  288.  
  289.                     The fill_symbol and align_symbol pragmas take a
  290.                     symbol (i.e. a variable that may be a C global,
  291.                     an automatic variable, but not a formal and not
  292.                     an element of a structured type like a struct or
  293.                     an array).  The second argument in the pragma
  294.                     may be one of the keywords L1cacheline (machine
  295.                     specific first-level cache line size, typically
  296.                     32 bytes), L2cacheline (machine specific
  297.                     second-level cache line size, typically 128
  298.                     bytes), page (machine specific page size,
  299.                     typically 16 Kbytes), or a user-specified
  300.                     power-of-two value.
  301.  
  302.                     The align_symbol pragma aligns the start of the
  303.                     named symbol at the specified alignment, i.e.
  304.                     the symbol "s" will start at the specified
  305.                     alignment boundary.
  306.  
  307.                     The fill_symbol pragma pads the named symbol
  308.                     with additional storage so that the symbol is
  309.                     assured not to overlap with any other data item
  310.                     within the storage of the specified size. The
  311.                     additional padding required is heuristically
  312.                     divided between each end of the specified
  313.                     variable. For instance, a fill_symbol pragma for
  314.                     the L1cacheline will guarantee that the
  315.                     specified symbol will not suffer from false-
  316.                     sharing for the L1 cache line.
  317.  
  318.                     For global variables these pragma must be
  319.                     specified at the variable definition, and are
  320.                     optional at the declarations of the variable.
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.                                                - 6 -
  333.  
  334.  
  335.  
  336.                     The align_symbol pragma is ineffective for local
  337.                     variables of fixed-size symbols, such as simple
  338.                     scalars or arrays of known size. The pragma
  339.                     continues to be effective for stack-allocated
  340.                     arrays of dynamically-determined size.
  341.  
  342.                     A variable cannot have both fill_symbol and
  343.                     align_symbol pragma applied to it.
  344.  
  345.  
  346.                     4.7  _E_n_h_a_n_c_e_m_e_n_t__f_o_r__M_u_l_t_i_p_r_o_c_e_s_s_i_n_g
  347.  
  348.  
  349.                     Several new enhancements related to
  350.                     multiprocessing have been made to MIPSpro C 7.2:
  351.  
  352.  
  353.                     4.7.1  _D_a_t_a__D_i_s_t_r_i_b_u_t_i_o_n__P_r_a_g_m_a_s   MIPSpro 7.2 C
  354.                     now supports pragmas for page-level data
  355.                     distribution and dynamic redistribution. These
  356.                     include _p_a_g_e__p_l_a_c_e, _d_i_s_t_r_i_b_u_t_e, _d_i_s_t_r_i_b_u_t_e
  357.                     _r_e_s_h_a_p_e, _d_y_n_a_m_i_c, _r_e_d_i_s_t_r_i_b_u_t_e.
  358.  
  359.  
  360.  
  361.                     4.7.2  _O_t_h_e_r__N_e_w__M_P__P_r_a_g_m_a_s   The following list
  362.                     of pragmas are new for 7.2 and related to
  363.                     multiprocessing:  _c_o_n_c_u_r_r_e_n_t, _s_e_r_i_a_l, _c_o_n_c_u_r_r_e_n_t
  364.                     _c_a_l_l, _c_o_n_c_u_r_e_n_t_i_z_e, _n_o_c_o_n_c_u_r_r_e_n_t_i_z_e, _p_r_e_f_e_r
  365.                     _s_e_r_i_a_l, _p_r_e_f_e_r _c_o_n_c_u_r_r_e_n_t, _p_e_r_m_u_t_a_t_i_o_n.
  366.  
  367.                     The full set of pragmas supported by C are
  368.                     described in the new _M_I_P_S_p_r_o _C _a_n_d _C++ _P_r_a_g_m_a_s
  369.                     manual.
  370.  
  371.  
  372.  
  373.                     4.7.3  _M_P___S_L_A_V_E___S_T_A_C_K_S_I_Z_E  The stacksize of
  374.                     slave processes can be controlled through the
  375.                     environment variable MP_SLAVE_STACKSIZE, which
  376.                     may be set to the desired stacksize in bytes.
  377.                     The default value is 16 Mbytes (4 MB for greater
  378.                     than 64 threads).
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.                                                - 7 -
  399.  
  400.  
  401.  
  402.                     4.8  _S_t_r_i_c_t_e_r__E_r_r_o_r__M_e_s_s_a_g_e
  403.  
  404.  
  405.                     The example below would incorretly compile with
  406.                     MIPSpro 7.1 without any errors. The MIPSpro 7.2
  407.                     compilers will emit an error:
  408.  
  409.                     Example:
  410.  
  411.                     %cat a.c
  412.                     struct st1_t;
  413.                     struct st2_t {
  414.                         struct st1_t st1;
  415.                     };
  416.                     struct st2_t st2;
  417.                     main()
  418.                     {
  419.                     }
  420.                     %cc -n32 -c a.c
  421.                     "a.c", line 3: error(1070): incomplete type is not allowed
  422.                      struct st1_t st1;
  423.                      ^
  424.  
  425.                     1 error detected in the compilation of "a.c".
  426.  
  427.                     The fix is to declare a complete type before its
  428.                     use.
  429.  
  430.  
  431.  
  432.                     4.9  _S_t_r_i_c_t_e_r__W_a_r_n_i_n_g__M_e_s_s_a_g_e
  433.  
  434.  
  435.                     The C compiler now checks the arguments with the
  436.                     corresponding conversion specification in the
  437.                     format strings of calls to printf(), sprintf(),
  438.                     fprintf(), scanf(), fscanf, and sscanf(). This
  439.                     can result in the following warning:
  440.  
  441.                     warning/error(1178): argument is incompatible with corresponding
  442.                     format string conversion
  443.  
  444.                     This is normally a warning. However, it will be
  445.                     reported as an error if the -_d_i_a_g__e_r_r_o_r option
  446.                     is used. The fix is to use the correct
  447.                     conversion character for the type of the
  448.                     argument.
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.                                                - 8 -
  465.  
  466.  
  467.  
  468.                     4.10  _P_R_I_N_T_F_L_I_K_E___l_i_n_t___s_t_y_l_e___c_o_m_m_e_n_t
  469.  
  470.  
  471.                     These are lint comments for checking validity of
  472.                     arguments They applies lint style check to the
  473.                     first (n-1) arguments as usual. The nth argument
  474.                     is interpreted as a printf format string that is
  475.                     used to check the remaining arguments.
  476.  
  477.  
  478.                     4.11  _S_C_A_N_F_L_I_K_E___l_i_n_t___s_t_y_l_e___c_o_m_m_e_n_t
  479.  
  480.  
  481.                     This comment applies lint style check to the
  482.                     first (n-1) arguments as usual. The nth argument
  483.                     is interpreted as a scanf format string that is
  484.                     used to check the remaining arguments.
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.